<?php
/**
 * @Create by PhpStorm
 * @author:jinxiu89@163.com
 * @Create Date:2020/7/4 14:46
 * @User: admin
 * @Current File : Index.php
 * @格言：溪涧岂能留得住，终归大海做波涛 --李忱
 * @格言： 我的内心因看见大海而波涛汹涌
 **/

namespace app\frontend\controller\category;


use app\frontend\controller\Base;
use think\App;
use think\facade\View;
use app\frontend\service\Category;
use think\Request;

/**
 * Class Index
 * @package app\frontend\controller\category
 */
class Index extends Base
{
    /**
     * Index constructor.
     * @param App $app
     */
    public function __construct(App $app)
    {
        parent::__construct($app);
    }

    /**
     *
     */
    public function initialize()
    {
        parent::initialize(); // TODO: Change the autogenerated stub
    }

    public function index(){
        var_dump("路由正确");exit();
    }

    /**
     * 获取分类类目
     * @param Request $request
     */
    public function categoryList(Request $request ){

        if ($request->isGet()){
            $data = Category::getCategoryDate((int) $status = 1, (int) $this->language);
            var_dump($data);exit();
            if (!empty($data)){
                View::assign('data', $data);
                return View::fetch($this->template . '/category/categoryList.html');
            }else{
                return "获取分类失败";
            }
        }else{
            return "获取分类失败";
        }

    }

}